using UnityEngine;
using System.Collections;

public class FollowPlayer : MonoBehaviour {
	
	Transform PlayerPosition;
	private bool GamePaused = true;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if(!GamePaused){
			PlayerPosition.Rotate(0, Input.GetAxis("Mouse X") * 15, 0);
	
			/*transform.rotation = PlayerPosition.rotation;
			transform.position = PlayerPosition.position - new Vector3(1, -3.5f, 0);
			transform.position = PlayerPosition.forward*4;*/
			
	        var rotation = PlayerPosition.rotation;
	        var position = rotation * new Vector3(0.75f, 3.5f, -2.5f) + PlayerPosition.position;
	        transform.rotation = rotation;
	        transform.position = position;
		}
	}
	
	void SetTarget(Transform playerPosition){
		PlayerPosition = playerPosition;
	}
	
	void TogglePause(){
		GamePaused = !GamePaused;
	}
}
